/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-12
 * Time: 11:04
 */
public class Student {
    //    字段/属性/成员变量
    private String name;
    private int age;
    private String stuNum;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

    //    行为/成员方法
    public void eat(){
        System.out.println(name + "正在吃饭...");
    }

    public void doClass(Student this){
        System.out.println(this.name + "正在上课");
    }

    //    构造方法
    public Student(){
        this("hangman",18,"20230502107");
        System.out.println("这是一个无参的构造方法");
    }

    public Student(String name, int age, String stuNum) {
        this.name = name;
        this.age = age;
        this.stuNum = stuNum;
        System.out.println("这是一个带有参数的构造方法");
    }
    public static void main(String[] args) {
        Student stu1 = new Student();//利用类实例化对象
       /* System.out.println(stu1.name);
        System.out.println(stu1.stuNum);
        System.out.println(stu1.age);*/
        stu1.setName("hao man");
        stu1.setStuNum("20230502107");
        stu1.setAge(18);
        System.out.println(stu1.getName());
        System.out.println(stu1.getStuNum());
        System.out.println(stu1.getAge());
    }
}
